#ifndef _STEPPER_H_
#define _STEPPER_H_
#include "sys.h"
#include "counter.h"
#ifdef __cplusplus
 extern "C" {
#endif
//DIR
#define DIR_LARGE			STEPPER_CCW
#define DIR_SMALL			STEPPER_CW

#define	STEPPER_CW			0x11	
#define STEPPER_CCW			0xFF
#define	STEPPER_UNKNOWN		0x99

//ID
#define PD15_TIM4_CH4 	0x01//PUL1  DIR1 PD11 //slave TIM5_CH4  ITR2
#define PD14_TIM4_CH3 	0x02//PUL1  DIR2 PD10 //slave TIM5_CH3  ITR2
#define PD13_TIM4_CH2 	0x04//PUL3  DIR3 PD9  //slave TIM5_CH2  ITR2
#define PD12_TIM4_CH1	0x08//PUL4  DIR4 PD8  //slave TIM5_CH1  ITR2
//#define PE13_TIM1_CH3	0x10//PUL5  DIR5 PB15 //slave TIM8_CH3  ITR0
#define PE11_TIM1_CH2	0x10//PUL6  DIR6 PB14   //slave TIM8_CH2  ITR0
#define PE9_TIM1_CH1	0x20//PUL7  DIR7 PE12   //slave TIM8_CH1  ITR0
//#define PB1_TIM3_CH4	0x80//PUL8  DIR8 PE10   //slave TIM2_CH4  ITR2
#define PB4_TIM3_CH1	0x40//PUL9  DIR9 PE8   //slave TIM2_CH1  ITR2
#define PB5_TIM3_CH2	0x80//PUL10 DIR10 PE7  //slave TIM2_CH2  ITR2

#define	STEPPER_ONE 		PD15_TIM4_CH4 
#define	STEPPER_TWO 		PD14_TIM4_CH3
#define	STEPPER_THREE 		PD13_TIM4_CH2
#define	STEPPER_FOUR 		PD12_TIM4_CH1
#define	STEPPER_FIVE		PE11_TIM1_CH2  
#define	STEPPER_SIX 		PE9_TIM1_CH1
#define	STEPPER_SEVEN 		PB4_TIM3_CH1
#define	STEPPER_EIGHT		PB5_TIM3_CH2
//#define	STEPPER_NIGHT 		PE9_TIM1_CH1
//#define	STEPPER_TEN			PB1_TIM3_CH4

//STATE
#define STEPPER_ON			0xFF
#define STEPPER_OFF			0x00

void StepperSetDirection(uint16_t ID,uint8_t dir);
void StepperSetVelocity(uint16_t ID,uint16_t psc);
void StepperOutput(uint16_t ID,uint8_t state);

#ifdef __cplusplus
}
#endif
#endif 

